FROM daocloud.io/centos:7 as builder

# Install Python 3.6 在进行安装时，使用&&连接多行的原因时：减少镜像层数量，压缩镜像体积
RUN yum -y install epel-release \
    && yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
    && yum -y install https://mirrors.aliyun.com/ius/ius-release-el7.rpm \
    && yum -y install python36u \
    && yum -y install python36u-pip \
    && yum -y install python36u-devel \
    # clean up cache
    && yum -y clean all \
    && mkdir -p /app/log \
    && mkdir -p /app/data

COPY requirements.txt /requirements.txt
RUN pip3 install --user -r /requirements.txt -i http://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

#定义时区参数
ENV TZ=Asia/Shanghai
#设置时区
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone

ENV app /app
WORKDIR ${app}
ADD analyze ${app}/analyze/
ADD basic ${app}/basic/
ADD config ${app}/config/
ADD download ${app}/download/
ADD generate ${app}/generate/
ADD handle ${app}/handle/
ADD mq ${app}/mq/
ADD public ${app}/public/
ADD store ${app}/store/
ADD main.py $app

# 自己的部分
CMD ["python3", "main.py"]
